import logging

LOG_DEFAULT = 'defaultLogger.log'

'''对外提供'''
defaultLogger = logging.getLogger(LOG_DEFAULT)

fh = logging.FileHandler(LOG_DEFAULT)
fh.setFormatter(logging.Formatter('%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s'))
fh.setLevel(logging.DEBUG)

defaultLogger.addHandler(fh)

ch = logging.StreamHandler()
ch.setFormatter(logging.Formatter('%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s'))
ch.setLevel(logging.DEBUG)

defaultLogger.addHandler(ch)

if __name__ == '__main__':
    defaultLogger.exception(None)

